
import * as cc from "cc";
import { resourcesMgr } from "../loader/ResourcesMgr";
import { VMCenter } from "../vm/VMCenter";
import { VMEntity } from "../vm/VMEntity";
import { UIBase } from "./UIBase";
/**
 * Predefined variables
 * Name = UIWindowBase
 * DateTime = Sun Mar 20 2022 15:11:27 GMT+0800 (中国标准时间)
 * Author = 272493431
 * FileBasename = UIWindowBase.ts
 * FileBasenameNoExtension = UIWindowBase
 * URL = db://assets/scripts/framework/ui/UIWindowBase.ts
 * ManualUrl = https://docs.cocos.com/creator/3.4/manual/zh/
 *
 */
 
export class UIWindowBase extends UIBase{
    parent: cc.Node;

    onCtor(path: string): void {
        resourcesMgr.load("window",path,cc.Prefab,(err,prefab)=>{
            if(err){
                return;
            }
            let node: cc.Node = cc.instantiate(prefab);
            this.node = node;
            node.parent = cc.find("Canvas");
            this.onLoaded();
        });
    }

    close(){
        this.onUnloaded();
        this.node.destroy();
    }
    
    /**
     * 窗口激活
     */
     onActive(){
        console.log(`UIBase-> ${this.uuid} 激活`);
        
    }

    /**
     * 窗口冻结
     */
    onFreeze(){
        console.log(`UIBase-> ${this.uuid} 冻结`);
    }

}